package com.ebring.shareEducation.controller;


import com.ebring.shareEducation.bean.response.Talentrsg;
import com.ebring.shareEducation.bean.IndustryLable;
import com.ebring.shareEducation.bean.SkillsLable;
import com.ebring.shareEducation.bean.Talent;
import com.ebring.shareEducation.service.TalentService;
import com.ebring.shareEducation.utils.RspMsg;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TalentController {

    @Autowired
    private TalentService talentService;

    /**
     * 查询所有行业
     *
     * @return
     */
    @PostMapping("/IndustryLable/list")
    public RspMsg<IndustryLable> select() {
        return talentService.selectIndustry();
    }

    /**
     * 查询所有技能
     *
     * @return
     */
    @PostMapping("/skillsLable/selectSkills")
    public RspMsg<SkillsLable> selectSkills(String industryId) {
        return talentService.selectSkills(industryId);
    }

    /**
     * 新增加的技能
     *
     * @return
     */
    @PostMapping("/Talent/insertTalent")
    public RspMsg<Talent> insertTalent(Talent talent) {
        return talentService.insertTalent(talent);
    }

    /**
     * 查询所有人才信息
     * 根据人才类别查询详细信息
     * 根据talentId查看人才信息详情,industryId行业id,talentType任务类型
     *
     * @return
     */
    @PostMapping("/talent/selectTalent")
    public RspMsg<List<Talentrsg>> selectTalent(@RequestParam(required = false) Integer pageNum, Integer pageSize, String talentId, String industryId, String talentType, String phone, String state) {
        if (pageNum == null) {
            pageNum = 1;
        }
        if (pageSize == null) {
            pageSize = 5;
        }
        PageHelper.startPage(pageNum, pageSize);
        return talentService.selectTalent(talentId, industryId, talentType, phone, state);
    }

    /**
     * 查询所有人才信息
     * 根据人才类别查询详细信息
     * 根据talentId查看人才信息详情,industryId行业id,talentType任务类型
     *
     * @return
     */
    @PostMapping("/talent/selectPhoneTalent")
    public RspMsg<List<Talentrsg>> selectPhoneTalent(@RequestParam(required = false) String talentId, String industryId, String talentType) {
        return talentService.selectPhoneTalent(talentId, industryId, talentType);
    }

    /**
     * 根据人才ID查看人员信息
     *
     * @return
     */
    @PostMapping("/talent/selectIdTalent")
    public RspMsg<Talent> selectIdTalent(Talent talent) {
        return talentService.selectIdTalent(talent);
    }

    /**
     * 审核人才技能
     */
    @PostMapping("/talent/auditTalent")
    public RspMsg auditTalent(String talentId, String state) {

        return talentService.auditTalent(talentId, state);
    }

    /**
     * 获取个人信息及技能
     */
    @PostMapping("/user/personalInfoAndSkillsInfoStatus")
    public RspMsg personalInfoAndSkillsInfoStatus(String userId) {
        return talentService.personalInfoAndSkillsInfoStatus(userId);
    }
}